import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '城市编码',
    align:"center",
    dataIndex: 'stcd'
   },
   {
    title: '城市名称',
    align:"center",
    dataIndex: 'stnm'
   },
   {
    title: '所属省份',
    align:"center",
    dataIndex: 'prvnc'
   },
   {
    title: '时间',
    align:"center",
    dataIndex: 'tm',
    // customRender:({text}) =>{
    //   return !text?"":(text.length>10?text.substr(0,10):text)
    // },
   },
   {
    title: '大气压',
    align:"center",
    dataIndex: 'airpre'
   },
   {
    title: '体感温度',
    align:"center",
    dataIndex: 'feelst'
   },
   {
    title: '相对湿度',
    align:"center",
    dataIndex: 'hmdt'
   },
   {
    title: '舒适度',
    align:"center",
    dataIndex: 'icmft'
   },
   {
    title: 'img',
    align:"center",
    dataIndex: 'img'
   },
   {
    title: '天气描述',
    align:"center",
    dataIndex: 'info'
   },
   {
    title: '雨量',
    align:"center",
    dataIndex: 'rain'
   },
   {
    title: 'rcmft',
    align:"center",
    dataIndex: 'rcmft'
   },
   {
    title: '温度',
    align:"center",
    dataIndex: 'tmprtr'
   },
   {
    title: '温差',
    align:"center",
    dataIndex: 'tmprdf'
   },
   {
    title: '风向',
    align:"center",
    dataIndex: 'direct'
   },
   {
    title: '风力',
    align:"center",
    dataIndex: 'power'
   },
   {
    title: '风速',
    align:"center",
    dataIndex: 'speed'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '城市编码',
    field: 'stcd',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入城市编码!'},
          ];
     },
  },
  {
    label: '城市名称',
    field: 'stnm',
    component: 'Input',
  },
  {
    label: '所属省份',
    field: 'prvnc',
    component: 'Input',
  },
  {
    label: '时间',
    field: 'tm',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入时间!'},
          ];
     },
  },
  {
    label: '大气压',
    field: 'airpre',
    component: 'Input',
  },
  {
    label: '体感温度',
    field: 'feelst',
    component: 'Input',
  },
  {
    label: '相对湿度',
    field: 'hmdt',
    component: 'Input',
  },
  {
    label: '舒适度',
    field: 'icmft',
    component: 'Input',
  },
  {
    label: 'img',
    field: 'img',
    component: 'Input',
  },
  {
    label: '天气描述',
    field: 'info',
    component: 'Input',
  },
  {
    label: '雨量',
    field: 'rain',
    component: 'Input',
  },
  {
    label: 'rcmft',
    field: 'rcmft',
    component: 'Input',
  },
  {
    label: '温度',
    field: 'tmprtr',
    component: 'Input',
  },
  {
    label: '温差',
    field: 'tmprdf',
    component: 'Input',
  },
  {
    label: '风向',
    field: 'direct',
    component: 'Input',
  },
  {
    label: '风力',
    field: 'power',
    component: 'Input',
  },
  {
    label: '风速',
    field: 'speed',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}